<template>
	<view class="boxs">
		<view class="head flex_op">
			<navigator class="head_left ali-c" open-type="navigateBack">
				<image src="http://oos-cn.ctyunapi.cn/hfclass/fanhui.png?Signature=UxKzt/fO7QiCKXVEBjkGnSGdoIw%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101242" style="width: 16rpx;height: 30rpx;margin-right: 20rpx;"  ></image>
				<text>返回</text>
			</navigator>
			<view style="position: relative;left: -40rpx;">人脸测温记录</view>
			<view class="head_right" ></view>
		</view>
		<view style="height: 120rpx;"></view>
		<view class="conent">
			<view class="flex_op opps">
				<view class="cu-form-group" style="width: 520rpx; height: 80rpx;">
					<picker mode="date" :value="date" start="2015-09-01" :end="tims"  @change="DateChange">
						<view >{{date}}</view>
					</picker>
				</view>
				<view class="ali-c searchs" @click="searchChaX">
					<icon type="search" size="14" color='#ffffff'/>
					<view>查询</view>
				</view>
			</view>
			<view class="rlcw flex_op" v-for="(item, index) in list" :key='index'>
				<view class="ali-c names">
					<view>{{item.recordTime[0]+' '+item.recordTime[1].slice(0, 5)}}</view>
					<view>{{item.name}}</view>
				</view>
				<view class="ali-c">
					<text>{{item.temperature}}</text>
					<!-- <image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E6%8B%A9%E7%AE%AD%E5%A4%B415X22.png?Signature=8Ry%2BydghTC67iii673JW%2BmJlX5s%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585102035"  style="width: 16rpx;height: 30rpx; margin-left: 20rpx;"></image> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import App from '../../App.vue'
	export default {
		data() {
			return {
				date: '2018-12-25',
				loadingType:0,
				list:[],
				userId:'',
				designation:'',
				tims:''
			}
		},
		onReachBottom(){
			this.getrenlcw()
		},
		onLoad(op) {
			var that=this
			that.getTimes()
			if(op.id){
				that.userId=op.id
				that.getrenlcw()
			}
			// else{
			// 	if(this.userId==0||this.userId==null||this.userId==''||this.userId==undefined){
			// 		this.gitObj()
			// 	}
			// }
		},
		methods:{
			searchChaX(){
				this.loadingType=0
				this.getrenlcw()
			},
			getrenlcw(){
				var that=this, arrs=[]
				that.loadingType++
				uni.showLoading({
					title:"加载中..."
				})
				uni.request({
					method:'POST',
					url:App.globalData.baseUrl + '/api/services/app/organUser/GetMyBindFaceTempratureHistory',
					data:{
						"userId": that.userId,
						"recordTime": that.date,
						"skipCount": that.loadingType>0?(that.loadingType-1)*20:0,
						"maxResultCount":20
					}, success(res) {
						uni.hideLoading()
						uni.stopPullDownRefresh();//得到数据后停止下拉刷新
						if(res.data.success==true){
							if(res.data.result.totalCount==that.list.length){
								uni.showToast({
									title: '已是所有数据',
									duration: 2000
								});
							}else{
								arrs=res.data.result.items
								that.list=that.list.concat(arrs)
								that.list.forEach((item, index)=>{
									item.recordTime=item.recordTime.split('T')
								})
							}
						}
					}, fail() {
						uni.hideLoading()
						uni.stopPullDownRefresh();//得到数据后停止下拉刷新
					}
				})
			},
			getTimes(){//获取当天日期
				let date=new Date(),that=this
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var strDate = date.getDate();
				if (month >= 1 && month <= 9) {
					month = "0" + month;
				}
				if (strDate >= 0 && strDate <= 9) {
					strDate = "0" + strDate;
				}
				that.date=year+'-'+month+'-'+strDate
				that.tims=year+'-'+month+'-'+strDate
			},
			DateChange(e) {
				this.date = e.detail.value
			},
			// gitObj(){
			// 	var that=this
			// 	that.loadModal=true
			// 	uni.request({
			// 		method:'POST',
			// 		url:App.globalData.baseUrl + '/api/services/app/session/GetCurrentLoginInformations',
			// 		success(res) {
			// 			if(res.data.result==null||res.data.result.user==undefined||res.data.result.user==null||res.data.result.user==''){
			// 				that.loadModal=false
			// 				uni.showToast({
			// 					icon:'none',
			// 					duration:2000,
			// 					title:'未登录'
			// 				})
			// 				let cl=setTimeout(()=>{
			// 					window.location.href='/wx/GetCode'
			// 					clearTimeout(cl)
			// 				},2000)
			// 			}else{
			// 				that.userId=res.data.result.user.id
			// 				that.getonlon()
			// 			}
			// 		},fail(res) {
			// 			that.loadModal=false
			// 			uni.showToast({
			// 				title:res.data.error.message,
			// 				duration:1000,
			// 				icon:'none'	,
			// 			})
			// 		}
			// 	})
			// },
		}
	}
</script>

<style scoped>
	.boxs{width: 100%;}
	.head{
		height: 120rpx;
		width: 100%;
		background-color: #FFFFFF;
		padding: 0 30rpx;
		font-size: 30rpx;
		position: fixed;
		top:0rpx;
		left:0rpx;
		z-index: 100;
	}
	.conent{width: 100%;padding: 0 30rpx;}
	.opps{
		height: 110rpx;
	}
	.ops{color: #FFFFFF;}
	.col{color: #000000;}
	.cu-form-group{min-height: 0rpx;border: 1rpx solid #eee;}
	.searchs{
		padding: 20rpx 30rpx;
		background-color: #1CBBB4;
	}
	.searchs>view{color: #FFFFFF;}
	
	.rlcw{
		height: 100rpx;
	}
	.names>view:nth-child(1){margin-right: 60rpx;}
</style>
